#' get aditional traits names if avaliable
#'
#' @usage
#' get_trait_names(pop)
#' get_trait_names(com)
#' get_traits(data,trait_names)
#'
#' @param com a community object
#' @param pop a population object
#' @param data a population or community object
#' @param trait_names a vector of trait names
#' @param as_datafame whether return a data.frame contains the trait values
#' 
#' 
#' @examples
#' data(BCI)
#' 
#' get_trait_names(BCI)
#'
#'
#'
#'@export
get_traits=function(data,trait_names,drop=FALSE){
  ti=match(trait_names,colnames(data))
  tr=data[,ti,drop=drop]
  attr(tr,"plotdim")=NULL #remove the extra attribute
  attr(tr,"species")=NULL
  return(tr)
}

#' @export
get_trait_names=function(x){
  UseMethod("get_trait_names")
}

#' @export
get_trait_names.community=function(com){
  return(setdiff(colnames(com),c("species","x","y")))
}

#' @export
get_trait_names.population=function(pop){
  return(setdiff(colnames(pop),c("x","y")))
}
